home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / printing / sdump1_5.lzh / sdump1_5.s < prev   
Text File  |  1990-03-09  |  11KB  |  279 lines

  1.                  move.l  #message,-(sp) ;address of string on stack
  2.                  move.w  #$9,-(sp)      ;Prt line
  3.                  trap    #1             ;Gemdos
  4.                  addq.l  #6,sp          ;clear stack
  5.  
  6.                  pea     cont           ;address of sup exec
  7.                  move.w  #38,-(sp)      ;sup exec funtion
  8.                  trap    #14            ;xbios
  9.                  addq.l  #6,sp          ;fix stack
  10.  
  11.                  move.w  #0,-(sp)       ;I don't understand this #
  12.                  move.l  #1100,-(sp)    ;amount of bytes to keep
  13.                  move.w  #$31,-(sp)     ;keep process
  14.                  trap    #1             ;gemdos
  15.  
  16. cont:
  17.                  move.l  #start,$502    ;move my address for alt-help
  18.                  rts
  19.  
  20. start:
  21.                  move.w  #4,-(sp);      ;Getrez
  22.                  trap    #14            ;Xbios call
  23.                  addq.l  #2,sp          ;correct stack
  24.  
  25.                  move.w  d0,rez         ;save resolution
  26.                                         ;0=low, 1=med, 2=high
  27.                  cmp.w   #2,d0          ;is it high?
  28.                  bne     nc1            ;no
  29.                  rts
  30. nc1:
  31.                  cmp.w   #1,d0          ;is it medium?
  32.                  bne     nc2
  33.                  move.w  #3,numcolors   ;yes, save # of colors
  34.                  move.l  #1,pix_width   ;2-1 pixels wide in med res
  35.                  bra     nc3
  36. nc2:
  37.                  move.w  #15,numcolors  ;it's low, 16 colors
  38.                  move.l  #3,pix_width   ;4-1 pixels wide in low res
  39.  
  40. nc3:
  41.                  move.w  numcolors,d3
  42.                  move.l  #palette+1,a2  ;get address of palette
  43.                  add.w   d3,a2          ;plus # of colors
  44. get_pal:
  45.                  move.w  #-1,-(sp)      ;-1 means to get color
  46.                  move.w  d3,-(sp)       ;color number
  47.                  move.w  #7,-(sp)       ;Setcolor function
  48.                  trap    #14            ;Xbios call
  49.                  addq.l  #6,sp          ;correct stack
  50.  
  51.                  move.w  d0,d2          ;save color
  52.                  and.w   #$000f,d0      ;get blue value
  53.                  move.b  d0,-(a2)       ;save value
  54.                  
  55.                  move.w  d2,d0          ;save color
  56.                  and.w   #$00f0,d0      ;get green color
  57.                  lsr.w   #4,d0          ;shift to low byte
  58.                  add.b   d0,(a2)        ;add green value
  59.  
  60.                  and.w   #$0f00,d2      ;get red color
  61.                  lsr.w   #8,d2          ;shift to low byte
  62.                  add.b   d2,(a2)        ;add red value
  63.                                         ;decrement address to next color
  64.  
  65.                  dbra    d3,get_pal     ;loop until negative
  66.  
  67.                  move.l  #0,d6          ;left side of screen
  68.                  move.l  #0,d7        ;bottom of screen
  69.  
  70.                  dc.w    $a000          ;A-line routine: Init
  71.  
  72.                  move.l  12(a0),a3      ;a3=address of Ptsin-arrays
  73.  
  74. x_inc:
  75.                  move.w  #$b,-(sp)      ;Constat
  76.                  trap    #1             ;Gemdos
  77.                  addq.l  #2,sp          ;make room on stack
  78.                  tst.w   d0             ;Char available? 0=no
  79.                  beq     x_inc2         ;continue
  80.                  rts                    ;abort program
  81.  
  82. x_inc2:
  83.                  bsr     statchk
  84.                  btst    #0,d0          ;if d0=0, continue
  85.                  beq     xcont          ;d0=1, abort
  86.                  rts
  87.  
  88. xcont:
  89.                  move.w  #7,d3          ;5 chars to output
  90.                  move.l  #string,a4     ;address of string to output
  91.  
  92. prtloop:
  93.                  move.w  #0,d0          ;clear d0
  94.                  move.b  (a4)+,d0       ;get byte to output
  95.                  move.w  d0,-(sp)       ;char to be outputted
  96.                  move.w  #5,-(sp)       ;Cprnout
  97.                  trap    #1             ;GEMDOS
  98.                  addq.l  #4,sp          ;correct stack
  99.  
  100.                  dbra    d3,prtloop     ;loop until done
  101.  
  102. y_dec:
  103.                  move.l  #pix1,a4       ;address of pixel data
  104.                  move.w  #5,d3          ;count 6 times...
  105.  
  106. y_loop:
  107.                  move.w  #0,d0          ;clear d0
  108.                  move.w  d6,(a3)        ;x coor
  109.                  move.w  d7,2(a3)       ;y coor
  110.                  dc.w    $a002          ;get pixel color
  111.                  move.w  d0,(a4)+       ;save pixel color
  112.                  add.b   #1,d7          ;increment y cor
  113.  
  114.                  dbra    d3,y_loop      ;do all 6 pixels
  115.  
  116. print:
  117.                  sub.b   #6,d7          ;reset y coor to original
  118.                  move.w  #5,d2          ;do pixel 6,5,4,3,2,1
  119.                  move.l  #pix1,a5       ;adrs of pixel color storage
  120.                  move.l  #hue1,a4       ;address of offset to prt data
  121. pal_loop:
  122.                  move.l  #palette,a2    ;address of color palette
  123.                  move.w  (a5)+,d1       ;get pixel value
  124.                  move.b  0(a2,d1.w),d0  ;get HUE value from palette
  125.                                         ;for coresponding color
  126.                  move.w  numcolors,d1   ;get resolution
  127.                  move.w  #0,d3
  128. hue_loop:
  129.                  cmp.b   (a2)+,d0       ;compare to other hues
  130.                  bge     nochange       ;increment only if d0 is >
  131.                  add.w   #1,d3          ;larger the #, darker the color
  132. nochange:
  133.                  dbra    d1,hue_loop    ;continue looping
  134.                  move.w  rez,d0         ;get resolution AGAIN!
  135.                  cmp.w   #0,d0          ;low?
  136.                  beq     lr
  137.                  cmp.w   #1,d0          ;medium?
  138.                  beq     mr
  139.  
  140. mr:
  141.                  move.l  #medtable,a1   ;address of table for medium
  142.                  bra     saveoffset     ;continue
  143. lr:
  144.                  move.l  #lowtable,a1;  ;address of table for low
  145.  
  146. saveoffset:
  147.                  move.b  0(a1,d3.w),d4  ;get the offset to print data
  148.                  move.b  d4,(a4)+       ;save the offset
  149.  
  150.                  dbra    d2,pal_loop    ;FINALLY!  After this is finished,
  151.                                         ;hue1, hue2...  will
  152.                                         ;contain the offset of the
  153.                                         ;printing data (c0, c1...)
  154.                                         ;all I have to do is load it in,
  155.                                         ;and shift it to the correct
  156.                                         ;position! (ugh..)
  157.  
  158.                  move.l  #c0,a4         ;address of print data
  159.                  move.l  pix_width,d5   ;# dots wide for each pixel
  160. dots:
  161.                  move.w  #2,d1          ;do OUTPUT loop 3 times (bytes)
  162.                  move.l  #hue1,a5       ;address of offsets
  163.  
  164. output:
  165.                  move.w  #0,d2
  166.                  move.b  (a5)+,d2        ;get offset of data
  167.                  move.b  0(a4,d2.w),d3  ;d3 now contain actual value
  168.                  lsl     #4,d3          ;shift to high bits
  169.  
  170.                  move.b  (a5)+,d2       ;get offset of hue #2
  171.                  move.b  0(a4,d2.w),d4  ;d4 contains actual value
  172.                  add.b   d4,d3          ;d3 contain whole byte to
  173.                                         ;be outputted to printer
  174.  
  175.                  bsr     statchk
  176.                  btst    #0,D0          ;IF D0=0, CONT
  177.                  beq     prtcont        ;d0=1, abort
  178.                  rts
  179.  
  180. prtcont:
  181.                  move.w  d3,-(sp);      ;byte to be outputted
  182.                  move.w  #5,-(sp);      ;printer device
  183.                  trap    #1             ;bios
  184.                  addq.l  #4,sp          ;correct stack
  185.  
  186.                  dbra    d1,output      ;do this for all hues!!!
  187.  
  188.                  add.l   #1,a4          ;next dot
  189.                  dbra    d5,dots        ;..
  190.  
  191.                  add.w   #1,d6          ;add 1 to x cor
  192.                  move.w  rez,d5         ;get rez.
  193.                  lsl     #1,d5          ;double
  194.                  move.l  #hres,a0       ;address of horizontal reses
  195.  
  196.